#pragma once
#ifdef _WINDOWS  //64位系统没有预定义 WIN32
#ifdef __cplusplus
#define DLL_EXPORT_C_DECL extern "C" __declspec(dllexport)
#else
#define DLL_EXPORT_DECL __declspec(dllexport)
#endif
#else
#ifdef __cplusplus
#define DLL_EXPORT_C_DECL extern "C"
#else
#define DLL_EXPORT_DECL extern
#endif
#endif

#ifdef _WINDOWS
#define WIN32_LEAN_AND_MEAN             //  从 Windows 头文件中排除极少使用的信息
#include "stddef.h"
#ifdef WIN32
#define WINAPI      __cdecl
#include "../include/HSMdApi.h"
#pragma comment(lib, "../../sdk/win64/HSMdApi.lib")
#else
#define WINAPI      __stdcall
#include "../include/HSMdApi.h"
#pragma comment(lib, "../../sdk/win64/HSMdApi.lib")
#endif
#else
#define WINAPI
#include "../include/HSMdApi.h"
#endif

#include <string.h>

class Quote: CHSMdSpi
{
public:
    Quote(void);
    
	//  当客户端与交易后台开始建立通信连接，连接成功后此方法被回调。
	typedef void (WINAPI *FrontConnectedType)(void*);
	void *_FrontConnected;
	virtual void OnFrontConnected(){if (_FrontConnected) ((FrontConnectedType)_FrontConnected)(this);}
    
	// 当客户端与交易后台通信连接异常时，该方法被调用。
	typedef void (WINAPI *FrontDisconnectedType)(void*, int nResult);
	void *_FrontDisconnected;
	virtual void OnFrontDisconnected(int nResult){if (_FrontDisconnected) ((FrontDisconnectedType)_FrontDisconnected)(this, nResult);}
    
	//  订阅-行情应答
	typedef void (WINAPI *RspDepthMarketDataSubscribeType)(void*, CHSRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	void *_RspDepthMarketDataSubscribe;
	virtual void OnRspDepthMarketDataSubscribe(CHSRspInfoField *pRspInfo, int nRequestID, bool bIsLast){if (_RspDepthMarketDataSubscribe) ((RspDepthMarketDataSubscribeType)_RspDepthMarketDataSubscribe)(this, pRspInfo, nRequestID, bIsLast);}
    
	//  订阅取消-行情应答
	typedef void (WINAPI *RspDepthMarketDataCancelType)(void*, CHSRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	void *_RspDepthMarketDataCancel;
	virtual void OnRspDepthMarketDataCancel(CHSRspInfoField *pRspInfo, int nRequestID, bool bIsLast){if (_RspDepthMarketDataCancel) ((RspDepthMarketDataCancelType)_RspDepthMarketDataCancel)(this, pRspInfo, nRequestID, bIsLast);}
    
	//  主推-行情
	typedef void (WINAPI *RtnDepthMarketDataType)(void*, CHSDepthMarketDataField *pDepthMarketData);
	void *_RtnDepthMarketData;
	virtual void OnRtnDepthMarketData(CHSDepthMarketDataField *pDepthMarketData){if (_RtnDepthMarketData) ((RtnDepthMarketDataType)_RtnDepthMarketData)(this, pDepthMarketData);}
    
};
